# 示例1：写入警告消息
# Write-Warning "This is only a test warning."

# 示例2：将字符串传递给Write-Warning
# $w = "This is only a test warning"
# $w | Write-Warning

# 示例3：设置$WarningPreference变量并写入警告
# $WarningPreference
# Continue

# $w = "This is only a test warning"
# $w | Write-Warning

# $WarningPreference = "SilentlyContinue"
# $w | Write-Warning
# $WarningPreference = "Stop"
# $w | Write-Warning

# $w | Write-Warning

# 示例4：设置WarningAction参数并写入警告
Write-Warning "This is only a test warning." -WarningAction Inquire